package com.quanquan.management.repository;

import com.quanquan.management.entity.SysPermissionRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @description:
 * @author:lihonglinag
 * @date:2019-03-22 14:28
 * @version:v 1.0.0
 */
public interface SysPermissionRoleRepository extends JpaRepository<SysPermissionRole,String> {
    /**
     * 根据角色id查询所有权限Id
     * @param roleId
     * @return
     */
    List<SysPermissionRole> findByRoleId(String roleId);

    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(value="delete from oo_sys_permission_role where role_id =?1" ,nativeQuery=true)
    public  int removeShip(String roleId);
}
